///////////////////////////////////////////////////////////////////////////////
// Filename: DirectX_10_Sound.h
///////////////////////////////////////////////////////////////////////////////
#ifndef _DirectX_10_Sound_H_
#define _DirectX_10_Sound_H_


/////////////
// LINKING //
/////////////
#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "winmm.lib")


//////////////
// INCLUDES //
//////////////
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include <stdio.h>


namespace Omen {

///////////////////////////////////////////////////////////////////////////////
// Class name: DirectX_10_Sound
///////////////////////////////////////////////////////////////////////////////
class DirectX_10_Sound
{
private:
	struct Mp3HeaderType
	{
		char chunkId[4];
		unsigned long chunkSize;
		char format[4];
		char subChunkId[4];
		unsigned long subChunkSize;
		unsigned short audioFormat;
		unsigned short numChannels;
		unsigned long sampleRate;
		unsigned long bytesPerSecond;
		unsigned short blockAlign;
		unsigned short bitsPerSample;
		char dataChunkId[4];
		unsigned long dataSize;
	};

public:
	DirectX_10_Sound();
	DirectX_10_Sound(const DirectX_10_Sound&);
	~DirectX_10_Sound();

	bool Initialize(HWND);
	void Shutdown();

private:
	bool InitializeDirectSound(HWND);
	void ShutdownDirectSound();

	bool LoadMp3File(char*, IDirectSoundBuffer8**);
	void ShutdownMp3File(IDirectSoundBuffer8**);

	bool PlayMp3File();

private:
	IDirectSound8* m_DirectSound;
	IDirectSoundBuffer* m_primaryBuffer;
	IDirectSoundBuffer8* m_secondaryBuffer1;
};

} // namepsace Omen
#endif